﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IODataAccess;
using IOEntity;
namespace IOBusiness
{
    public class clsBSAdmin
    {
        clsDAAdmin obj = new clsDAAdmin();
        public clsAdmin GetById(int id)
        {
            try
            {
                return obj.GetById(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        public List<clsAdmin> GetAll()
        {
            try
            {
                return obj.GetAll();
            }
            catch (Exception)
            {

                throw;
            }
        }
        public clsAdmin GetByUserPassword(string username,string password)
        {
            try
            {
                return obj.GetByUserPassword(username,clsBSMD5Password.ChangeMD5(password));
            }
            catch (Exception)
            {

                throw;
            }
        }
        public int Insert(clsAdmin obj)
        {
            try
            {
                obj.MatKhau = clsBSMD5Password.ChangeMD5(obj.MatKhau);
                return this.obj.Insert(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }
        public void Update(clsAdmin obj)
        {
            try
            {
                obj.MatKhau = clsBSMD5Password.ChangeMD5(obj.MatKhau);
                this.obj.Update(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }
        public void Delete(int id)
        {
            try
            {
                this.obj.Delete(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
